/*     */ package com.jcrj.action.info;
/*     */ 
/*     */ import com.jcrj.action.BaseAction;
/*     */ import com.jcrj.entity.OColumn;
/*     */ import com.jcrj.entity.OInfo;
/*     */ import com.jcrj.entity.OInfoContent;
/*     */ import com.jcrj.entity.OUser;
/*     */ import com.jcrj.entity.TemplateFile;
/*     */ import com.jcrj.service.InfoManagerService;
/*     */ import com.jcrj.service.SysLogService;
/*     */ import com.jcrj.service.TemplateService;
/*     */ import com.jcrj.util.FileIo;

/*     */ import java.io.IOException;
/*     */ import java.io.PrintWriter;
/*     */ import java.util.Date;
/*     */ import java.util.List;
/*     */ import java.util.Map;

/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ 
/*     */ public class InformationManagementAction extends BaseAction
/*     */ {
/*     */   private OColumn column;
/*     */   private OInfo info;
/*     */   private static List<OColumn> columns;
/*     */   private List<OInfo> infos;
/*     */   private InfoManagerService infoManagerService;
/*     */   private long totalCount;
/*     */   private long pageCount;
/*     */   private String[] ids;
/*     */   private String columnId;//栏目
/*     */   private String columnName;
/*     */   private String names;
/*     */   private String users;
/*     */   private int orgId;
/*     */   private String method;
/*     */   private TemplateService templateService;
/*     */   private static List<TemplateFile> templateList;
/*     */   private String contentId;
/*     */   private String content;
/*     */   private String tableName;
/*     */   private SysLogService sysLogService;
/*     */ 
/*     */   public String getTableName()
/*     */   {
/*  41 */     return this.tableName;
/*     */   }
/*     */ 
/*     */   public void setTableName(String tableName) {
/*  45 */     this.tableName = tableName;
/*     */   }
/*     */ 
/*     */   public OColumn getColumn() {
/*  49 */     return this.column;
/*     */   }
/*     */ 
/*     */   public void setColumn(OColumn column) {
/*  53 */     this.column = column;
/*     */   }
/*     */ 
/*     */   public OInfo getInfo() {
/*  57 */     return this.info;
/*     */   }
/*     */ 
/*     */   public void setInfo(OInfo info) {
/*  61 */     this.info = info;
/*     */   }
/*     */ 
/*     */   public List<OColumn> getColumns() {
/*  65 */     return columns;
/*     */   }
/*     */ 
/*     */   public void setColumns(List<OColumn> columns) {
/*  69 */     columns = columns;
/*     */   }
/*     */ 
/*     */   public List<OInfo> getInfos() {
/*  73 */     return this.infos;
/*     */   }
/*     */ 
/*     */   public void setInfos(List<OInfo> infos) {
/*  77 */     this.infos = infos;
/*     */   }
/*     */ 
/*     */   public InfoManagerService getInfoManagerService() {
/*  81 */     return this.infoManagerService;
/*     */   }
/*     */ 
/*     */   public void setInfoManagerService(InfoManagerService infoManagerService) {
/*  85 */     this.infoManagerService = infoManagerService;
/*     */   }
/*     */ 
/*     */   public long getTotalCount() {
/*  89 */     return this.totalCount;
/*     */   }
/*     */ 
/*     */   public void setTotalCount(long totalCount) {
/*  93 */     this.totalCount = totalCount;
/*     */   }
/*     */ 
/*     */   public long getPageCount() {
/*  97 */     return this.pageCount;
/*     */   }
/*     */ 
/*     */   public void setPageCount(long pageCount) {
/* 101 */     this.pageCount = pageCount;
/*     */   }
/*     */ 
/*     */   public String[] getIds() {
/* 105 */     return this.ids;
/*     */   }
/*     */ 
/*     */   public void setIds(String[] ids) {
/* 109 */     this.ids = ids;
/*     */   }
/*     */ 
/*     */   public String noticeList() {
/* 113 */     if ("2".equals(this.columnId)) {
/* 114 */       this.tableName = "通知通报";
/*     */     }
/* 116 */     if ("1".equals(this.columnId)) {
/* 117 */       this.tableName = "最新公告";
/*     */     }
/* 119 */     this.totalCount = this.infoManagerService
/* 120 */       .countNotice(this.columnId, 
/* 120 */       super.getStartDate(), super.getEndDate(), super.getTitle());
/* 121 */     this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/* 122 */     if (super.getCurrentPage() > this.pageCount) {
/* 123 */       super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */     }
/* 125 */     this.infos = this.infoManagerService
/* 126 */       .getNotice(super.getCurrentPage(), this.columnId, 
/* 126 */       super.getStartDate(), super.getEndDate(), super.getTitle());
/* 127 */     return "success";
/*     */   }
/*     */ 
/*     */   public String columnManagement()
/*     */   {
/* 132 */     OUser user = (OUser)super.getSession().get("userInfo");
/* 133 */     this.totalCount = this.infoManagerService.countTotalOColumns();
/* 134 */     this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/* 135 */     if (super.getCurrentPage() > this.pageCount) {
/* 136 */       super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */     }
/* 138 */     columns = this.infoManagerService.getOColumnss(super.getCurrentPage());
/* 139 */     return "success";
/*     */   }
/*     */ 
/*     */   public String columnById()
/*     */   {
/* 144 */     this.column = ((OColumn)this.infoManagerService.getObject(new OColumn(), Integer.valueOf(this.columnId).intValue()));
/* 145 */     return "success";
/*     */   }
/*     */ 
/*     */   public String columnUpdate()
/*     */   {
/*     */     try {
/* 151 */       OUser user = (OUser)getSession().get("userInfo");
/* 152 */       OColumn columnUpdate = (OColumn)this.infoManagerService.getObject(new OColumn(), Integer.valueOf(this.column.getId().intValue()).intValue());
/* 153 */       columnUpdate.setName(this.column.getName());
/* 154 */       this.infoManagerService.updateColumn(columnUpdate);
/* 155 */       this.sysLogService.saveLog("信息管理", user.getName(), "修改了" + columnUpdate.getName() + "的栏目信息");
/* 156 */       super.getResponse().getWriter().write("success");
/* 157 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 159 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 162 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/* 164 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 162 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/* 164 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 167 */     return null;
/*     */   }
/*     */ 
/*     */   public String columnDelete()
/*     */   {
/*     */     try {
/* 173 */       OUser user = (OUser)getSession().get("userInfo");
/* 174 */       this.infoManagerService.deleteColumns(this.ids);
/* 175 */       this.sysLogService.saveLog("信息管理", user.getName(), "删除了某些栏目");
/* 176 */       super.getResponse().getWriter().write("success");
/* 177 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 179 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 182 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/* 184 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 182 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/* 184 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 187 */     return null;
/*     */   }
/*     */ 
/*     */   public String columnAdd()
/*     */   {
/* 192 */     return "success";
/*     */   }
/*     */ 
/*     */   public String columnSave()
/*     */   {
/*     */     try {
/* 198 */       OUser user = (OUser)getSession().get("userInfo");
/* 199 */       this.column.setUserId(user.getId());
/* 200 */       this.column.setUserName(user.getName());
/* 201 */       this.column.setCreateTime(new Date());
/* 202 */       this.column.setDel("0");
/* 203 */       this.infoManagerService.saveColumn(this.column);
/* 204 */       this.sysLogService.saveLog("信息管理", user.getName(), "添加了" + this.column.getName() + "的栏目信息");
/* 205 */       super.getResponse().getWriter().write("success");
/* 206 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 208 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 211 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/* 213 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 211 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/* 213 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 216 */     return null;
/*     */   }
/*     */ 
/*     */   public String informationReport()
/*     */   {
/* 221 */     templateList = this.templateService.findTemplateList();
/* 222 */     return "success";
/*     */   }
/*     */ 
/*     */   public String saveInfoReport()
/*     */   {
/*     */     try {
/* 228 */       OUser user = (OUser)super.getSession().get("userInfo");
/* 229 */       this.info.setColumnId(Integer.valueOf(Integer.parseInt(this.columnId)));
/* 230 */       if ("1".equals(this.columnId))
/* 231 */         this.info.setColumnName("最新公告");
/* 232 */       else if ("2".equals(this.columnId)) {
/* 233 */         this.info.setColumnName("通知通报");
/*     */       }
/* 235 */       this.info.setClick(Integer.valueOf(0));
/* 236 */       this.info.setUserId(user.getId());
/* 237 */       this.info.setUserName(user.getName());
/* 238 */       this.info.setPublish("0");
/* 239 */       this.info.setContentId(this.contentId);
/* 240 */       this.info.setCreateTime(new Date());
/* 241 */       this.info.setDel("0");
/* 242 */       this.infoManagerService.saveInfo(this.info);
/* 243 */       this.sysLogService.saveLog("信息管理", user.getName(), "添加了" + this.info.getColumnName() + ":" + this.info.getTitle() + "的信息");
/*     */     } catch (Exception e) {
/* 245 */       e.printStackTrace();
/*     */     }
/* 247 */     return "success";
/*     */   }
/*     */ 
/*     */   @SuppressWarnings("unchecked")
public String informationReview()
/*     */   {
/*     */     try
/*     */     {
/* 254 */       this.totalCount = this.infoManagerService.countTotalOInfos(this.columnId, super.getTitle(), super.getStartDate(), super.getEndDate());
/* 255 */       this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/* 256 */       if (super.getCurrentPage() > this.pageCount) {
/* 257 */         super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */       }
/* 259 */       this.infos = this.infoManagerService.getOInfos(this.columnId, super.getTitle(), super.getStartDate(), super.getEndDate(), super.getCurrentPage());
/*     */     }
/*     */     catch (Exception e) {
/* 262 */       e.printStackTrace();
/*     */     }
/* 264 */     return this.method;
/*     */   }
/*     */ 
/*     */   public String informationReviewPublishInformation()
/*     */   {
/*     */     try {
/* 270 */       OUser user = (OUser)super.getSession().get("userInfo");
/* 271 */       this.infoManagerService.publishInfos(this.ids);
/* 272 */       this.sysLogService.saveLog("信息管理", user.getName(), "审核了信息");
/* 273 */       super.getResponse().getWriter().write("success");
/* 274 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 276 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 279 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/* 281 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 279 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/* 281 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 284 */     return null;
/*     */   }
/*     */ 
/*     */   public String informationReviewById()
/*     */   {
/* 289 */     this.info = ((OInfo)this.infoManagerService.getObject(new OInfo(), this.info.getId().intValue()));
/* 290 */     setContentId(this.info.getContentId());
/* 291 */     templateList = this.templateService.findTemplateList();
/* 292 */     return "success";
/*     */   }
/*     */ 
/*     */   public String getInfoNew() {
/* 296 */     this.info = ((OInfo)this.infoManagerService.getObject(new OInfo(), this.info.getId().intValue()));
/* 297 */     if (this.info != null) {
/* 298 */       OInfoContent oc = this.infoManagerService.getInfoContent(this.info.getContentId());
/* 299 */       setContent(FileIo.getContentToString(oc.getContent()));
/*     */     }
/* 301 */     return "success";
/*     */   }
/*     */ 
/*     */   public String getInfoView() {
/* 305 */     this.info = ((OInfo)this.infoManagerService.getObject(new OInfo(), this.info.getId().intValue()));
/* 306 */     return "success";
/*     */   }
/*     */ 
/*     */   public String informationUpdate()
/*     */   {
/*     */     try {
/* 312 */       OInfo infoUpdate = (OInfo)this.infoManagerService.getObject(
/* 313 */         new OInfo(), this.info.getId().intValue());
/* 314 */       infoUpdate.setColumnId(Integer.valueOf(Integer.parseInt(this.columnId)));
/* 315 */       if ("1".equals(this.columnId))
/* 316 */         infoUpdate.setColumnName("最新公告");
/* 317 */       else if ("2".equals(this.columnId)) {
/* 318 */         infoUpdate.setColumnName("通知通报");
/*     */       }
/* 320 */       infoUpdate.setTitle(this.info.getTitle());
/* 321 */       infoUpdate.setFileId(this.info.getFileId());
/* 322 */       this.infoManagerService.updateInfo(infoUpdate);
/*     */     } catch (Exception e) {
/* 324 */       e.printStackTrace();
/*     */     }
/* 326 */     return "success";
/*     */   }
/*     */ 
/*     */   public String informationReviewDeleteInformation()
/*     */   {
/*     */     try {
/* 332 */       this.infoManagerService.deleteInfos(this.ids);
/* 333 */       super.getResponse().getWriter().write("success");
/* 334 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 336 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 339 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/* 341 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 339 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/* 341 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 344 */     return null;
/*     */   }
/*     */ 
/*     */   public String infoInit() {
/* 348 */     columns = this.infoManagerService.getOColumns();
/* 349 */     return "success";
/*     */   }
/*     */ 
/*     */   public String infoListByColumn() {
/*     */     try {
/* 354 */       this.columnName = this.infoManagerService.getColumnName(Integer.parseInt(this.columnId));
/* 355 */       OUser user = (OUser)super.getSession().get("userInfo");
/* 356 */       String agent = this.sysLogService.getAgentUser(user);
/* 357 */       this.totalCount = this.infoManagerService.countInfoByUser(this.columnId, agent, user, super.getStartDate(), super.getEndDate(), super.getTitle());
/* 358 */       this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/* 359 */       if (super.getCurrentPage() > this.pageCount) {
/* 360 */         super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */       }
/* 362 */       this.infos = this.infoManagerService.findInfoByUser(super.getCurrentPage(), this.columnId, agent, user, super.getStartDate(), super.getEndDate(), super.getTitle());
/*     */     }
/*     */     catch (Exception e) {
/* 365 */       e.printStackTrace();
/*     */     }
/* 367 */     return "success";
/*     */   }
/*     */ 
/*     */   public String infoListAll() {
/*     */     try {
/* 372 */       OUser user = (OUser)super.getSession().get("userInfo");
/* 373 */       String agent = this.sysLogService.getAgentUser(user);
/* 374 */       this.totalCount = this.infoManagerService.countInfoByUser(this.columnId, agent, user, super.getStartDate(), super.getEndDate(), super.getTitle());
/* 375 */       this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/* 376 */       if (super.getCurrentPage() > this.pageCount) {
/* 377 */         super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */       }
/* 379 */       this.infos = this.infoManagerService.findInfoByUser(super.getCurrentPage(), this.columnId, agent, user, super.getStartDate(), super.getEndDate(), super.getTitle());
/* 380 */       columns = this.infoManagerService.getOColumns();
/*     */     } catch (Exception e) {
/* 382 */       e.printStackTrace();
/*     */     }
/* 384 */     return "success";
/*     */   }
/*     */ 
/*     */   public String saveInfoUser() {
/*     */     try {
/* 389 */       OUser user = (OUser)super.getSession().get("userInfo");
/* 390 */       this.info.setClick(Integer.valueOf(0));
/* 391 */       this.info.setDel("0");
/* 392 */       this.info.setUserId(user.getId());
/* 393 */       this.info.setUserName(user.getName());
/* 394 */       this.info.setCreateTime(new Date());
/* 395 */       this.infoManagerService.saveInfo(this.info, this.users, this.names, this.content);
/* 396 */       this.sysLogService.saveLog("信息管理", user.getName(), "上报了" + this.info.getColumnName() + ":" + this.info.getTitle() + "的信息");
/* 397 */       super.getResponse().getWriter().write("success");
/* 398 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 400 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 403 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/* 405 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 403 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/* 405 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 408 */     return null;
/*     */   }
/*     */ 
/*     */   public String getNames() {
/* 412 */     return this.names;
/*     */   }
/*     */ 
/*     */   public void setNames(String names) {
/* 416 */     this.names = names;
/*     */   }
/*     */ 
/*     */   public String getColumnId() {
/* 420 */     return this.columnId;
/*     */   }
/*     */ 
/*     */   public void setColumnId(String columnId) {
/* 424 */     this.columnId = columnId;
/*     */   }
/*     */ 
/*     */   public String getUsers() {
/* 428 */     return this.users;
/*     */   }
/*     */ 
/*     */   public void setUsers(String users) {
/* 432 */     this.users = users;
/*     */   }
/*     */ 
/*     */   public int getOrgId() {
/* 436 */     return this.orgId;
/*     */   }
/*     */ 
/*     */   public void setOrgId(int orgId) {
/* 440 */     this.orgId = orgId;
/*     */   }
/*     */ 
/*     */   public String getMethod() {
/* 444 */     return this.method;
/*     */   }
/*     */ 
/*     */   public void setMethod(String method) {
/* 448 */     this.method = method;
/*     */   }
/*     */ 
/*     */   public TemplateService getTemplateService() {
/* 452 */     return this.templateService;
/*     */   }
/*     */ 
/*     */   public void setTemplateService(TemplateService templateService) {
/* 456 */     this.templateService = templateService;
/*     */   }
/*     */ 
/*     */   public List<TemplateFile> getTemplateList() {
/* 460 */     return templateList;
/*     */   }
/*     */ 
/*     */   public void setTemplateList(List<TemplateFile> templateList) {
/* 464 */     templateList = templateList;
/*     */   }
/*     */ 
/*     */   public String getContentId() {
/* 468 */     return this.contentId;
/*     */   }
/*     */ 
/*     */   public void setContentId(String contentId) {
/* 472 */     this.contentId = contentId;
/*     */   }
/*     */ 
/*     */   public String getContent() {
/* 476 */     return this.content;
/*     */   }
/*     */ 
/*     */   public void setContent(String content) {
/* 480 */     this.content = content;
/*     */   }
/*     */ 
/*     */   public String getColumnName() {
/* 484 */     return this.columnName;
/*     */   }
/*     */ 
/*     */   public void setColumnName(String columnName) {
/* 488 */     this.columnName = columnName;
/*     */   }
/*     */ 
/*     */   public SysLogService getSysLogService() {
/* 492 */     return this.sysLogService;
/*     */   }
/*     */ 
/*     */   public void setSysLogService(SysLogService sysLogService) {
/* 496 */     this.sysLogService = sysLogService;
/*     */   }
/*     */ }

/* Location:           /Volumes/work/oa/WEB-INF/classes/
 * Qualified Name:     com.jcrj.action.info.InformationManagementAction
 * JD-Core Version:    0.6.0
 */